{extend name="public/container"}
{block name="content"}
<div class="row">
    <div class="col-sm-12">
        <div class="ibox float-e-margins">
            <div class="tabs-container ibox-title">
                <ul class="nav nav-tabs">
                    {foreach name="group_list" item="v" key="k"}
                    <li  {if condition="$k==$inc_type"}class="active"{/if}>
                        <a href="{:url('setting.SystemConfig/index',['inc_type'=> $k])}"><span>{$v}</span></a>
                    </li>
                     {/foreach}
                </ul>
               
                <div class="tab-content">
                   
                    <div class="p-m m-t-sm">
                        <form action="{:url('set_handle')}" enctype="multipart/form-data" method="post" id="handlepost" class=" layui-anim-up layui-form form-container">
                            <div class="layui-form-item">
                             
                                <div class="layui-form-item">
                                    <label class="layui-form-label label-required" for="record_no">储存引擎</label>
                                    <div class="layui-input-block">
                                       {foreach ['1'=>'本地服务器存储','2'=>'七牛云存储','3'=>'阿里云OSS存储','4'=>'腾讯云COS存储'] as $k=>$v}
                                        <label class="think-radio">
                                            <input  {$config.storage_type == $k ? 'checked' : ''} type="radio" name="storage_type" value="{$k}" title="{$v}">
                                        </label>
                                        {/foreach}
                                        <p  data-storage-type="1" class="layui-word-aux">文件存储在本地服务器，请确保服务器的 ./static/upload/ 目录有写入权限</p>
                                        <p  data-storage-type="2" class="layui-word-aux"> 若还没有七牛云帐号，可<a target="_blank" href="https://portal.qiniu.com/signup?code=3lhz6nmnwbple">免费申请10G存储</a>，申请成功后添加公开bucket。</p>
                                        <p  data-storage-type="3" class="layui-word-aux"> 若还没有OSS存储账号, 可<a target="_blank" href="https://oss.console.aliyun.com">创建阿里云OSS存储</a>，需要配置OSS公开访问及跨域策略。</p>
                                    </div>
                                  </div>
                                  <div class="layui-form-item col-md-6" data-storage-type="2">
                                        <label class="layui-form-label label-required" for="record_no">存储区域</label>
                                        <div class="layui-input-block" >
                                                {foreach ['华东','华北','华南','北美'] as $area}
                                          
                                                <label class="think-radio">
                                                    <input  {if isset($config.storage_qiniu_region) && $config.storage_qiniu_region == $area} checked {/if}    type="radio" name="storage_qiniu_region" value="{$area}" title="{$area}">                                   
                                                </label>
                                         
                                               
                                                {/foreach}
                                                <p class="layui-word-aux">七牛云存储空间所在区域，需要严格对应储存所在区域才能上传文件。</p>
                                        </div>
                                    </div>
                                <div class="layui-form-item col-md-6" data-storage-type="2">
                                        <label class="layui-form-label label-required" for="record_no">HTTP</label>
                                        <div class="layui-input-block" >
                                                {foreach ['http','https','auto'] as $pro}
                                                <label class="think-radio">
                                                  <input {if isset($config.storage_qiniu_is_https) && $config.storage_qiniu_is_https == $pro} checked {/if}  type="radio" name="storage_qiniu_is_https" value="{$pro}"  title="{$pro}">                                    
                                                </label>
                                                {/foreach}
                                            <p class="layui-word-aux">七牛云存储访问协议（http、https、auto），其中 https 需要配置证书才能使用，auto 为相对协议自动根据域名切换http与https。</p>
                                        </div>
                                </div>
        
                                <div class="layui-form-item col-md-6" data-storage-type="2">
                                        <label class="layui-form-label label-required" for="record_no">空间名称</label>
                                        <div class="layui-input-block" >
                                            <input type="text" name="storage_qiniu_bucket" required="required" value="{$config.storage_qiniu_bucket|default=''}"
                                                title="请输入七牛云存储 Bucket (空间名称)" placeholder="请输入七牛云存储 Bucket (空间名称)" class="layui-input">
                                            <p class="layui-word-auxk">填写七牛云存储空间名称，如：static</p>
                                        </div>
                                </div>
        
                                <div class="layui-form-item col-md-6" data-storage-type="2">
                                        <label class="layui-form-label label-required" for="record_no">访问域名</label>
                                        <div class="layui-input-block" >
                                             <input type="text" name="storage_qiniu_domain" required="required" value="{$config.storage_qiniu_domain|default=''}"
                                                title="请输入七牛云存储 Domain (访问域名)" placeholder="请输入七牛云存储 Domain (访问域名)" class="layui-input">
                                         <p class="layui-word-aux">填写七牛云存储访问域名，如：static.ctolog.cc</p>
                                        </div>
                                </div>

                                <div class="layui-form-item col-md-6" data-storage-type="2">
                                    <label class="layui-form-label label-required" for="storage_qiniu_static_path">七牛存储空间自定义目录</label>
                                    <div class="layui-input-block" >
                                        <input type="text" name="storage_qiniu_static_path" required="required" value="{$config.storage_qiniu_static_path|default=''}"
                                            title="请输入oss_static_path" placeholder="填写存储空间自定义目录" class="layui-input">
                                     <p class="layui-word-aux">存储空间自定义目录，如：test</p>
                                    </div>
                                </div>

                                <div class="layui-form-item col-md-6" data-storage-type="2">
                                        <label class="layui-form-label label-required" for="record_no">访问密钥</label>
                                        <div class="layui-input-block" >
                                         <input type="text" name="storage_qiniu_access_key" required="required" value="{$config.storage_qiniu_access_key|default=''}"
                                                title="请输入七牛云 AccessKey (访问密钥)" placeholder="请输入七牛云 AccessKey (访问密钥)" class="layui-input">
                                         <p class="layui-word-aux">可以在 [ 七牛云 > 个人中心 ] 设置并获取到访问密钥。</p>
                                        </div>
                                </div>
                                <div class="layui-form-item col-md-6" data-storage-type="2">
                                        <label class="layui-form-label label-required" for="record_no">安全密钥</label>
                                        <div class="layui-input-block" >
                                        <input type="text" name="storage_qiniu_secret_key" required="required" value="{$config.storage_qiniu_secret_key|default=''}" maxlength="43"
                                                title="请输入七牛云 SecretKey (安全密钥)" placeholder="请输入七牛云 SecretKey (安全密钥)" class="layui-input">
                                         <p class="layui-word-aux">可以在 [ 七牛云 > 个人中心 ] 设置并获取到安全密钥。</p>
                                        </div>
                                </div>
        
                                <div class="layui-form-item col-md-6" data-storage-type="3">
                                        <label class="layui-form-label label-required" for="record_no">空间名称</label>
                                        <div class="layui-input-block" >
                                            <input type="text" name="storage_oss_bucket" required="required" value="{$config.storage_oss_bucket|default=''}"
                                                title="请输入OSS Bucket (空间名称)" placeholder="请输入OSS Bucket (空间名称)" class="layui-input">
                                         <p class="layui-word-aux">填写OSS存储空间名称，如：think-admin-oss</p>
                                        </div>
                                </div>

                                <div class="layui-form-item col-md-6" data-storage-type="3">
                                    <label class="layui-form-label label-required" for="storage_oss_static_path">OSS存储空间自定义目录</label>
                                    <div class="layui-input-block" >
                                        <input type="text" name="storage_oss_static_path" required="required" value="{$config.storage_oss_static_path|default=''}"
                                            title="请输入oss_static_path" placeholder="填写OSS存储空间自定义目录" class="layui-input">
                                     <p class="layui-word-aux">填写OSS存储空间自定义目录，如：test</p>
                                    </div>
                                </div>
        
                                <div class="layui-form-item col-md-6" data-storage-type="3">
                                        <label class="layui-form-label label-required" for="record_no">数据中心</label>
                                        <div class="layui-input-block" >
                                                <input type="text" name="storage_oss_endpoint" required="required" value="{$config.storage_oss_endpoint|default=''}"
                                                title="请输入OSS数据中心访问域名 (访问域名)" placeholder="请输入OSS数据中心访问域名 (访问域名)" class="layui-input">
                                                 <p class="layui-word-aux">填写OSS数据中心访问域名，如：oss-cn-shenzhen.aliyuncs.com</p>
                                        </div>
                                </div>
        
                                <div class="layui-form-item col-md-6" data-storage-type="3">
                                        <label class="layui-form-label label-required" for="record_no">访问域名</label>
                                        <div class="layui-input-block" >
                                                <input type="text" name="storage_oss_domain" required="required" value="{$config.storage_oss_domain|default=''}"
                                                title="请输入OSS存储 Domain (访问域名)" placeholder="请输入OSS存储 Domain (访问域名)" class="layui-input">
                                         <p class="layui-word-aux">填写OSS存储外部访问域名，如：think-admin-oss.oss-cn-shenzhen.aliyuncs.com</p>
                                        </div>
                                </div>
        
                                <div class="layui-form-item col-md-6" data-storage-type="3">
                                        <label class="layui-form-label label-required" for="record_no">访问密钥</label>
                                        <div class="layui-input-block" >
                                            <input type="text" name="storage_oss_keyid" required="required" value="{$config.storage_oss_keyid|default=''}" maxlength="16"
                                                title="请输入16位OSS AccessKey (访问密钥)" placeholder="请输入OSS AccessKey (访问密钥)" class="layui-input">
                                         <p class="layui-word-aux">可以在 [ 阿里云 > 个人中心 ] 设置并获取到访问密钥。</p>
                                        </div>
                                </div>
                               
                                <div class="layui-form-item col-md-6" data-storage-type="3">
                                        <label class="layui-form-label label-required" for="record_no">安全密钥</label>
                                        <div class="layui-input-block" >
                                                <input type="text" name="storage_oss_secret" required="required" value="{$config.storage_oss_secret|default=''}" maxlength="30"
                                                title="请输入30位OSS SecretKey (安全密钥)" placeholder="请输入OSS SecretKey (安全密钥)" class="layui-input">
                                         <p class="layui-word-aux">可以在 [ 阿里云 > 个人中心 ] 设置并获取到安全密钥。</p>
                                        </div>
                                </div>
                                

                                <div class="layui-form-item col-md-6" data-storage-type="4">
                                    <label class="layui-form-label label-required" for="storage_cos_region">存储区域</label>
                                    <div class="layui-input-block" >
                                        <input type="text" name="storage_cos_region" required="required" value="{$config.storage_cos_region|default=''}" maxlength="30"
                                       placeholder="请输入COS 储存区域" class="layui-input">
                                            <p class="layui-word-aux">COS存储空间所在区域，需要严格对应储存所在区域才能上传文件。</p>
                                    </div>
                                </div>

                                <div class="layui-form-item col-md-6" data-storage-type="4">
                                    <label class="layui-form-label label-required" for="storage_cos_bucket">空间名称</label>
                                    <div class="layui-input-block" >
                                        <input type="text" name="storage_cos_bucket" required="required" value="{$config.storage_cos_bucket|default=''}"
                                            title="请输入COS存储 Bucket (空间名称)" placeholder="请输入COS存储 Bucket (空间名称)" class="layui-input">
                                        <p class="layui-word-auxk">填写COS存储空间名称，如：static</p>
                                    </div>
                                </div>

                                <div class="layui-form-item col-md-6" data-storage-type="4">
                                    <label class="layui-form-label label-required" for="storage_cos_domain">访问域名</label>
                                    <div class="layui-input-block" >
                                         <input type="text" name="storage_cos_domain" required="required" value="{$config.storage_cos_domain|default=''}"
                                            title="请输入COS存储 Domain (访问域名)" placeholder="请输入七牛云存储 Domain (访问域名)" class="layui-input">
                                     <p class="layui-word-aux">填写COS存储访问域名，如：static.ctolog.cc</p>
                                    </div>
                            </div>

                            <div class="layui-form-item col-md-6" data-storage-type="4">
                                <label class="layui-form-label label-required" for="storage_cos_static_path">COS存储空间自定义目录</label>
                                <div class="layui-input-block" >
                                    <input type="text" name="storage_cos_static_path" required="required" value="{$config.storage_cos_static_path|default=''}"
                                        title="请输入oss_static_path" placeholder="填写存储空间自定义目录" class="layui-input">
                                 <p class="layui-word-aux">存储空间自定义目录，如：test</p>
                                </div>
                            </div>

                            <div class="layui-form-item col-md-6" data-storage-type="4">
                                    <label class="layui-form-label label-required" for="storage_cos_access_key">访问密钥</label>
                                    <div class="layui-input-block" >
                                     <input type="text" name="storage_cos_access_key" required="required" value="{$config.storage_cos_access_key|default=''}"
                                            title="请输入七牛云 AccessKey (访问密钥)" placeholder="请输入七牛云 AccessKey (访问密钥)" class="layui-input">
                                     <p class="layui-word-aux">可以在 [ COS > 个人中心 ] 设置并获取到访问密钥。</p>
                                    </div>
                            </div>
                            <div class="layui-form-item col-md-6" data-storage-type="4">
                                    <label class="layui-form-label label-required" for="storage_cos_secret_key">安全密钥</label>
                                    <div class="layui-input-block" >
                                    <input type="text" name="storage_cos_secret_key" required="required" value="{$config.storage_cos_secret_key|default=''}" maxlength="43"
                                            title="请输入七牛云 SecretKey (安全密钥)" placeholder="请输入cos SecretKey (安全密钥)" class="layui-input">
                                     <p class="layui-word-aux">可以在 [ COS > 个人中心 ] 设置并获取到安全密钥。</p>
                                    </div>
                            </div>
    

                                <input type="hidden" name="inc_type" value="{$inc_type}">
                                  <div class="layui-form-item">
                                    <div class="layui-input-block">
                                    <a class="layui-btn" lay-submit lay-filter="ajax_form_submit">立即提交</a>
                                    </div>
                                  </div>
                        </form>
                     
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    (function () {
      buildForm('{$config.storage_type}');
      $('[name=storage_type]').on('click', function () {
          buildForm($('[name=storage_type]:checked').val())
      });

      // 表单显示编译
      function buildForm(value) {
          var $tips = $("[data-storage-type='" + value + "']");
          $("[data-storage-type]").not($tips.show()).hide();
      }
  })();
 
</script>
{/block}